<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title>修改DOM结构练习</title>
	<script src="../jquery/jquery-3.3.1.js"></script>
</head>
<body>
<!-- HTML结构 -->
<div id="test-div">
		<ul>
			<li><span>JavaScript</span></li>
			<li><span>Python</span></li>
		<li><span>Swift</span></li>
	</ul>
</div>
</body>
<script>
	//除了列出的3种语言外，请再添加Pascal、Lua和Ruby，然后按字母顺序排序节点：
	let ul = $("#test-div>ul");
	for(ele of ['Pascal','Lua','Ruby']) {
		ul.append(`<li><span>${ele}</span></li>`)
	}
	ul.find("li").sort(function (x,y) {
		let a = $(x).text(),
			b = $(y).text();
		return a > b;
	}).appendTo(ul);
</script>
</html>